#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int main()
{
    int i = 0;
    int j = 0;
    int k = 0;
    int total = 0;
    for (i = 10000; i < 99999; i++)
    {
        total = 0;
        for (j = 1; j <= 4; j++)
        {
            k = (int)pow(10,j);
            total += (i / k) * (i % k);
        }
        if (total == i)
        {
            printf("%d ",i);
        }
    }
    return 0;
}